package com.eagle.depthinspringboot.configuration.bootstrapt;

import com.eagle.depthinspringboot.configuration.condition.ConditionalOnSystemProperty;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

@EnableAutoConfiguration
public class EnableAutoConfigurationBootstrap {

//	@Bean
//	@ConditionalOnSystemProperty(name = "user.name", value = "Lenovo")
//	public String helloWorld2(){
//		return "Hello world again";
//	}

	public static void main(String[] args) {
		ConfigurableApplicationContext ctx = new SpringApplicationBuilder(EnableAutoConfigurationBootstrap.class)
				.web(WebApplicationType.NONE)
				.run(args);
		String helloWorld1 = ctx.getBean("helloWorld", String.class);
//		String helloWorld2 = ctx.getBean("helloWorld2", String.class);
		System.out.println("hello world bean: "+helloWorld1);
//		System.out.println("hello world bean2: "+helloWorld2);
	}
}
